<!doctype html>
<html lang="en">
<head>
    @include('web.layout.head')
    <link rel="stylesheet" href="{{asset('/control/city_linkage/css/city-picker.css')}}"/>
    <link rel="stylesheet" href="{{asset('/css/web/user/pw_revise.css')}}">
</head>
<body>
@include('web.layout.header')
@include('web.layout.user_tab')
<div class="base_member_content">
    <div class="w1200">
        @include('web.layout.member_nav')
        <div class="nav_right flr">
            <div class="base_content">
                <div class="line_title">邮箱修改</div>
                <div class="revise_subnav">
                    <ul>
                        <li>修改邮箱</li>
                        <li class="cur">验证邮箱</li>
                        <li >完成</li>
                    </ul>
                </div>
                <div class="revise_content">
                    <div class="box">
                        <form action="{{URL('member/user/email_reviseth')}}" id="email_revise2" method="post" onsubmit="return frm_data_check();">
                            <div style="display:inline-block">
                                <span>邮箱验证码：</span>
                                <input name='code' id='code' type="text" class="se getborder" >
                                <p class="jm_error" style="margin-left:150px;"></p>
                            </div>
                            <div style="display: block; text-align: center; width: 448px; padding: 49px;">
                                <div style="font-size: 22px; line-height: 22px; color: #69c336; text-align: center; margin-top: 28px;">已发送验证邮件至：{{array_get($data,'email')}}</div>
                                <div style="margin-top:12px;">验证邮件5分钟内有效，请尽快登录你的邮箱查看验证码完成验证。<br><em style="color: #ff8400;">（请立即完成验证，邮箱验证不通过则修改邮箱失败）</em></div>
                            </div>
                            <input type="hidden" name="_token" value="{{csrf_token()}}" />
                            <input type="hidden" name="type" value="update" />
                            <input type="hidden" name="email" value="{{array_get($data,'email')}}" />
                            <input type="submit" class="jm_btn6 submit" value="下一步" />
                        </form>
                    </div>
                    <div class="j-err" style="margin-left:312px; margin-top: 32px; color: red; font-size: large;"></div>
                </div>
                <div class="tips">
                    <h3>为什么要进行身份验证？</h3>
                    <div class="p">1. 为保障您的账户信息安全，在变更账户中的重要信息时需要进行身份验证，感谢您的理解和支持。<br>2. 验证身份遇到问题？请拨打客服电话400-016-6889。</div>
                </div>
            </div>
        </div>
    </div>
</div>
@include('web.layout.footer')
</body>
<script>
    function frm_data_check() {
        var _frm = $('#email_revise2');
        var _code = _frm.find('input[name="code"]');
        if (_code.val() == ''){
            _code.parent().find('.jm_error').html('请填写收到邮件中验证码');
            return false;
        }
    }


    $(function () {

        $('#email_revise2').submit(function () {
            var _frm = $('#email_revise2');
            var _code = _frm.find('input[name="code"]');
            if (_code.val() == ''){
                _code.parent().find('.jm_error').html('请填写收到邮件中验证码');
                return false;
            }
            //ajax提交获取
            url = $(this).attr('action');

            $.ajax({
                url: url,
                type: 'POST',
                dataType: 'json',
                data: $(this).serializeArray(),
                success: function (data) {
                    if (data.code == 0) {
                        layer.msg('修改成功，正在跳转到登录页面...',{
                          icon: 1,
                          time: 2000 //2秒关闭（如果不配置，默认是3秒）
                        },function(){
                            $.get(AJAX_URL+'/user/logout',function(){
                                   window.location.href = AJAX_URL + '/user/login';
                                 })
                        });
                    } else {
                        layer.alert(data.message, {
                            icon: 1
                        });
                    }
                    ;
                }
            })
            return false;
        })




    })




</script>
</html>